package com.example.dps;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import com.downpayment.dps.R;


public class EditTransferActivity extends Activity{
	
	TransferDBHelper transferDBHelper;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		transferDBHelper = new TransferDBHelper(this);
	
		setContentView(R.layout.edit_transfer_layout);
		
		addSpinners();
		
		
	}
	
	
	public void addSpinners(){
		Cursor transfersCursor = transferDBHelper.getTransfersAsCursor();
		
		String[] fromColumns = {transferDBHelper.COLUMN_TRANSFER_FROM, transferDBHelper.COLUMN_TRANSFER_TO, transferDBHelper.COLUMN_TRANSFER_AMOUNT};
		int[] toViews = { R.id.edit_transfer_list_item_from_text, R.id.edit_transfer_list_item_to_text, R.id.edit_transfer_list_item_amount_text};

		
		SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, 
		        R.layout.edit_transfer_list, transfersCursor, fromColumns, toViews, 0);
		
		
		/** From Account Spinner **/
		Spinner edit = (Spinner) findViewById(R.id.editTransferSpinner);
		// Apply the adapter to the spinner
		edit.setAdapter(adapter);
		/*************************/
	}
	
	
}
